﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.IO;
using System.Data.SqlClient;
using System.Drawing;
using System.Net.Mail;

using System.Web.Services;

public partial class admin_deleteagent : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["email"] == null)
        {
            Response.Redirect("sessiont.aspx");
        }
        int s = 0;
        Label1.Text = s.ToString();
        Label2.Text = Session["email"].ToString();
    }

    protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
    {

        if (e.CommandName == "active")
        {

            //Label1.Text = "hello";
            int index = Convert.ToSByte(e.CommandArgument);

            GridViewRow row = GridView1.Rows[index];
            SqlDataAdapter adp = new SqlDataAdapter();
            SqlCommand cmd = new SqlCommand();
            DataSet ds = new DataSet();


            SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["Connstr"].ConnectionString);

            //  SqlConnection con = new SqlConnection("Data Source=MRINAL-PC;Initial Catalog=onlinejobportal;User Id=sa;Password=mrinal");
            con.Open();

            SqlCommand objectvalue = new SqlCommand("", con);
            cmd.Connection = con;


            SqlCommand cmd1 = new SqlCommand("update agent_add set status=1 where a_id='" + row.Cells[0].Text + "'", con);
            cmd1.ExecuteNonQuery();

          //  Response.Write(@"<script language='javascript'>alert('Client is inactive now')</script>");
            Response.Redirect("delete_agent_conf.aspx");
            // con.Close();

            con.Close();
        }

    }
    protected void LinkButton1_Click(object sender, System.EventArgs e)
    {
        Session.Abandon();
        Response.Redirect("../admin.aspx");
    }


    //protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
    //{
    //    GridViewRow row = (GridViewRow)GridView1.Rows[e.RowIndex];
    //    Label lbldeleteid = (Label)row.FindControl("lblID");
    //    SqlConnection conn = null;
    //    SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["Connstr"].ConnectionString);
    //    conn.Open();
    //    SqlCommand cmd = new SqlCommand("delete * FROM tbl_SqlImage where id_field='" + lbldeleteid + "'", conn);
    //    cmd.ExecuteNonQuery();
    //    conn.Close();
    //    bind();



    //}
    protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
    {

    }
}